• doimatkhauthanhcong.aspx.cs
  • project /
1 using System;
2 using
System.Collections;
3 using
System.Configuration;
4 using
System.Data;
5 using
System.Linq;
6 using
System.Web;
7 using
System.Web.Security;
8 using
System.Web.UI;
9 using
System.Web.UI.HtmlControls;
10 using
System.Web.UI.WebControls;
11 using
System.Web.UI.WebControls.WebParts;
12 using
System.Xml.Linq;
13 using
System.Data.OleDb;
14
15 public
partial class doimatkhauthanhcong : System.Web.UI.Page
16 {
17     
protected void Page_Load(object sender, EventArgs e)
18     {
19
20     }
21     
protected void btndangnhap_Click(object sender, EventArgs e)
22     {
23         ado.ketNoi();
24         
string query = "select * from tbluser where email='" + txtemail.Text + "' and matkhau='" + txtpass.Text + "'";
25         ado.rd = ado.getData(query);
26         
if (ado.rd.Read())
27         {
28             FormsAuthentication.SetAuthCookie(txtemail.Text,
true);
29             Session[
"email"] = txtemail.Text;
30             Session[
"matkhau"] = ado.rd[1].ToString();
31             Session[
"quyen"] = ado.rd[2].ToString();
32             Session[
"hoten"] = ado.rd[3].ToString();
33             Session[
"diachi"] = ado.rd[4].ToString();
34             Session[
"dienthoai"] = ado.rd[5].ToString();
35             Session[
"soCMND"] = ado.rd[6].ToString();
36             Session[
"mataikhoan"] = ado.rd[7].ToString();
37
38             
if (Session["quyen"].ToString() == "admin")
39                 Response.Redirect(
"themqtri.aspx");
40             
else
41                 Response.Redirect(
"thongtintaikhoan.aspx", true);
42         }
43         
else
44         {
45             txtemail.Focus();
46         }
47
48         ado.rd.Dispose();
49         ado.dongKetNoi();
50     }
51    
52 }



Quản lý website giới thiệu và bán điện thoại di động ASP.net 19.275 lượt xem

Gõ tìm kiếm nhanh...